package com.chuanghai.light.exceptionhandle.emum;


import com.chuanghai.light.exceptionhandle.CommonError;

/**
 * @Auther: wzl
 * @Date: 2019/8/14 21:51
 * @Description: 全局异常
 */
public enum CommonErrorEmum implements CommonError {

    // 1**** 通用异常
    PARAMETER_VALIDATION_ERROR("10001","参数不合法"),
    REQUEST_WAY_ERROR("10002", "请求方法不支持"),
    PERMISSION_DENIED("10003", "权限不足"),
    OPERATION_FAIL("10004", "操作失败"),
    FILE_UPLOAD_ERROR("10005", "文件上传失败"),
    // 60000 未知错误
    UNKNOW_CODE("99999","未知错误")
    ;

    CommonErrorEmum(String errCode, String errMsg){
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    private String errCode;
    private String errMsg;

    @Override
    public String getErrorCode() {
        return this.errCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrorMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
